package com.xhg.mqtt.listener;

import java.io.Serializable;

/**
 * 消息事件处理
 *
 * @author E.T
 * @version 1.0
 * @Description
 * @date 2018-07-23 11:31
 * @updateby
 * @updatedate
 * @since 1.0
 */
public class MessageEvent implements Serializable {

  private static final long serialVersionUID = -5809782578272943999L;

  /**
   * 主题
   */
  private String topic;
  /**
   * 指令码
   */
  private String eventCode;
  /**
   * 事件源
   */
  private Object source;

  private byte[] message;

  /**
   * 当前时间
   */
  private long times;
  /**
   * 重发次数
   */
  private int count;

  /**
   * 初始化消息事件
   *
   * @param topic 发送的主题
   * @param message 发送的消息内容(二进制数组)
   * @param times 当前发送时间
   */
  public MessageEvent(String eventCode, String topic, byte[] message, long times) {
    this.topic = topic;
    this.message = message;
    this.times = times;
    this.eventCode = eventCode;
  }

  public String getTopic() {
    return topic;
  }

  public String getEventCode() {
    return eventCode;
  }

  public Object getSource() {
    return source;
  }

  public byte[] getMessage() {
    return message;
  }

  public long getTimes() {
    return times;
  }

  public int getCount() {
    return count;
  }

  public void setCount(int count) {
    this.count = count;
  }
}
